package com.company;

public class Main {

    public static void main(String[] args) {

        System.out.println("开始查找完数..." + "\n");

        int num = 0;                                //用于计算因子之合
        int i;                                //i的初始化

        System.out.println("完数包括这些：" + "\n");

        for (i = 1; i < 1001; i++) {
            for (int j = 1; j < i; j++) {
                if (0 == i % j)
                    num += j;
            }
            if (num == i)
                System.out.println(i + "   ");
            num = 0;                                   //重置num
        }
    }
}
